﻿
namespace SPL.Windows.Forms
{
	/// <summary>
	/// abstract DetailBatchTvt typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class DetailBatchTvtDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<DetailBatchTvtDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.DetailBatchTvt _currentDetailBatchTvt = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxDetailBatchTvtDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxDetailBatchTvtErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxDetailBatchTvtBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the Id property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIdDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the BatchId property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxBatchIdDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Me1 property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMe1DataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Me2 property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMe2DataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the IsStop property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxIsStopDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the CreatedBy property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxCreatedByDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the CreatedAt property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxCreatedAtDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the InputTime property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxInputTimeDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the Latest property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxLatestDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Batch> _BatchIdList;
		
		/// <summary> 
		/// The list of selectable Batch
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Batch> BatchIdList
		{
			get {return this._BatchIdList;}
			set 
			{
				this._BatchIdList = value;
				this.uxBatchIdDataGridViewColumn.DataSource = null;
				this.uxBatchIdDataGridViewColumn.DataSource = this._BatchIdList;
			}
		}
		
		private bool _allowNewItemInBatchIdList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Batch
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInBatchIdList
		{
			get { return _allowNewItemInBatchIdList;}
			set
			{
				this._allowNewItemInBatchIdList = value;
				this.uxBatchIdDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.DetailBatchTvt> _LatestList;
		
		/// <summary> 
		/// The list of selectable DetailBatchTvt
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.DetailBatchTvt> LatestList
		{
			get {return this._LatestList;}
			set 
			{
				this._LatestList = value;
				this.uxLatestDataGridViewColumn.DataSource = null;
				this.uxLatestDataGridViewColumn.DataSource = this._LatestList;
			}
		}
		
		private bool _allowNewItemInLatestList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of DetailBatchTvt
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInLatestList
		{
			get { return _allowNewItemInLatestList;}
			set
			{
				this._allowNewItemInLatestList = value;
				this.uxLatestDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.User> _CreatedByList;
		
		/// <summary> 
		/// The list of selectable User
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.User> CreatedByList
		{
			get {return this._CreatedByList;}
			set 
			{
				this._CreatedByList = value;
				this.uxCreatedByDataGridViewColumn.DataSource = null;
				this.uxCreatedByDataGridViewColumn.DataSource = this._CreatedByList;
			}
		}
		
		private bool _allowNewItemInCreatedByList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of User
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInCreatedByList
		{
			get { return _allowNewItemInCreatedByList;}
			set
			{
				this._allowNewItemInCreatedByList = value;
				this.uxCreatedByDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.DetailBatchTvt> _DetailBatchTvtList;
				
		/// <summary> 
		/// The list of DetailBatchTvt to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.DetailBatchTvt> DetailBatchTvtList
		{
			get {return this._DetailBatchTvtList;}
			set
			{
				this._DetailBatchTvtList = value;
				this.uxDetailBatchTvtBindingSource.DataSource = null;
				this.uxDetailBatchTvtBindingSource.DataSource = value;
				this.uxDetailBatchTvtDataGridView.DataSource = null;
				this.uxDetailBatchTvtDataGridView.DataSource = this.uxDetailBatchTvtBindingSource;				
				//this.uxDetailBatchTvtBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxDetailBatchTvtBindingSource_ListChanged);
				this.uxDetailBatchTvtBindingSource.CurrentItemChanged += new System.EventHandler(OnDetailBatchTvtBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnDetailBatchTvtBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentDetailBatchTvt = uxDetailBatchTvtBindingSource.Current as Entities.DetailBatchTvt;
			
			if (_currentDetailBatchTvt != null)
			{
				_currentDetailBatchTvt.Validate();
			}
			//_DetailBatchTvt.Validate();
			OnCurrentEntityChanged();
		}

		//void uxDetailBatchTvtBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.DetailBatchTvt"/> instance.
		/// </summary>
		public Entities.DetailBatchTvt SelectedDetailBatchTvt
		{
			get {return this._currentDetailBatchTvt;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxDetailBatchTvtDataGridView.VirtualMode;}
			set
			{
				this.uxDetailBatchTvtDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxDetailBatchTvtDataGridView.AllowUserToAddRows;}
			set {this.uxDetailBatchTvtDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxDetailBatchTvtDataGridView.AllowUserToDeleteRows;}
			set {this.uxDetailBatchTvtDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxDetailBatchTvtDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxDetailBatchTvtDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="DetailBatchTvtDataGridViewBase"/> class.
		/// </summary>
		public DetailBatchTvtDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxDetailBatchTvtDataGridView = new System.Windows.Forms.DataGridView();
			this.uxDetailBatchTvtBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxDetailBatchTvtErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIdDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxBatchIdDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxMe1DataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxMe2DataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIsStopDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxCreatedByDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxCreatedAtDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxInputTimeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxLatestDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			//this.uxBatchIdBindingSource = new BatchBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxBatchIdBindingSource)).BeginInit();
			//this.uxLatestBindingSource = new DetailBatchTvtBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxLatestBindingSource)).BeginInit();
			//this.uxCreatedByBindingSource = new UserBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxCreatedByBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDetailBatchTvtDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDetailBatchTvtBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDetailBatchTvtErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxDetailBatchTvtErrorProvider
			// 
			this.uxDetailBatchTvtErrorProvider.ContainerControl = this;
			this.uxDetailBatchTvtErrorProvider.DataSource = this.uxDetailBatchTvtBindingSource;						
			// 
			// uxDetailBatchTvtDataGridView
			// 
			this.uxDetailBatchTvtDataGridView.AutoGenerateColumns = false;
			this.uxDetailBatchTvtDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxDetailBatchTvtDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIdDataGridViewColumn,
		this.uxBatchIdDataGridViewColumn,
		this.uxMe1DataGridViewColumn,
		this.uxMe2DataGridViewColumn,
		this.uxIsStopDataGridViewColumn,
		this.uxCreatedByDataGridViewColumn,
		this.uxCreatedAtDataGridViewColumn,
		this.uxInputTimeDataGridViewColumn,
		this.uxLatestDataGridViewColumn			});
			this.uxDetailBatchTvtDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxDetailBatchTvtDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxDetailBatchTvtDataGridView.Name = "uxDetailBatchTvtDataGridView";
			this.uxDetailBatchTvtDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxDetailBatchTvtDataGridView.TabIndex = 0;	
			this.uxDetailBatchTvtDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxDetailBatchTvtDataGridView.EnableHeadersVisualStyles = false;
			this.uxDetailBatchTvtDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnDetailBatchTvtDataGridViewDataError);
			this.uxDetailBatchTvtDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnDetailBatchTvtDataGridViewCellValueNeeded);
			this.uxDetailBatchTvtDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnDetailBatchTvtDataGridViewCellValuePushed);
			
			//
			// uxIdDataGridViewColumn
			//
			this.uxIdDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIdDataGridViewColumn.DataPropertyName = "Id";
			this.uxIdDataGridViewColumn.HeaderText = "Id";
			this.uxIdDataGridViewColumn.Name = "uxIdDataGridViewColumn";
			this.uxIdDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIdDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIdDataGridViewColumn.ReadOnly = true;		
			//
			// uxBatchIdDataGridViewColumn
			//
			this.uxBatchIdDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxBatchIdDataGridViewColumn.DataPropertyName = "BatchId";
			this.uxBatchIdDataGridViewColumn.HeaderText = "BatchId";
			this.uxBatchIdDataGridViewColumn.Name = "uxBatchIdDataGridViewColumn";
			this.uxBatchIdDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxBatchIdDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxBatchIdDataGridViewColumn.ReadOnly = false;		
			//
			// uxMe1DataGridViewColumn
			//
			this.uxMe1DataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMe1DataGridViewColumn.DataPropertyName = "Me1";
			this.uxMe1DataGridViewColumn.HeaderText = "Me1";
			this.uxMe1DataGridViewColumn.Name = "uxMe1DataGridViewColumn";
			this.uxMe1DataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMe1DataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMe1DataGridViewColumn.ReadOnly = false;		
			//
			// uxMe2DataGridViewColumn
			//
			this.uxMe2DataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMe2DataGridViewColumn.DataPropertyName = "Me2";
			this.uxMe2DataGridViewColumn.HeaderText = "Me2";
			this.uxMe2DataGridViewColumn.Name = "uxMe2DataGridViewColumn";
			this.uxMe2DataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMe2DataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMe2DataGridViewColumn.ReadOnly = false;		
			//
			// uxIsStopDataGridViewColumn
			//
			this.uxIsStopDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIsStopDataGridViewColumn.DataPropertyName = "IsStop";
			this.uxIsStopDataGridViewColumn.HeaderText = "IsStop";
			this.uxIsStopDataGridViewColumn.Name = "uxIsStopDataGridViewColumn";
			this.uxIsStopDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIsStopDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIsStopDataGridViewColumn.ReadOnly = false;		
			//
			// uxCreatedByDataGridViewColumn
			//
			this.uxCreatedByDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxCreatedByDataGridViewColumn.DataPropertyName = "CreatedBy";
			this.uxCreatedByDataGridViewColumn.HeaderText = "CreatedBy";
			this.uxCreatedByDataGridViewColumn.Name = "uxCreatedByDataGridViewColumn";
			this.uxCreatedByDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxCreatedByDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxCreatedByDataGridViewColumn.ReadOnly = false;		
			//
			// uxCreatedAtDataGridViewColumn
			//
			this.uxCreatedAtDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxCreatedAtDataGridViewColumn.DataPropertyName = "CreatedAt";
			this.uxCreatedAtDataGridViewColumn.HeaderText = "CreatedAt";
			this.uxCreatedAtDataGridViewColumn.Name = "uxCreatedAtDataGridViewColumn";
			this.uxCreatedAtDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxCreatedAtDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxCreatedAtDataGridViewColumn.ReadOnly = false;		
			//
			// uxInputTimeDataGridViewColumn
			//
			this.uxInputTimeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxInputTimeDataGridViewColumn.DataPropertyName = "InputTime";
			this.uxInputTimeDataGridViewColumn.HeaderText = "InputTime";
			this.uxInputTimeDataGridViewColumn.Name = "uxInputTimeDataGridViewColumn";
			this.uxInputTimeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxInputTimeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxInputTimeDataGridViewColumn.ReadOnly = false;		
			//
			// uxLatestDataGridViewColumn
			//
			this.uxLatestDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxLatestDataGridViewColumn.DataPropertyName = "Latest";
			this.uxLatestDataGridViewColumn.HeaderText = "Latest";
			this.uxLatestDataGridViewColumn.Name = "uxLatestDataGridViewColumn";
			this.uxLatestDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxLatestDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxLatestDataGridViewColumn.ReadOnly = false;		
			//
			// uxBatchIdDataGridViewColumn
			//				
			this.uxBatchIdDataGridViewColumn.DisplayMember = "BatchNo";	
			this.uxBatchIdDataGridViewColumn.ValueMember = "Id";	
			this.uxBatchIdDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxBatchIdDataGridViewColumn.DataSource = uxBatchIdBindingSource;				
				
			//
			// uxLatestDataGridViewColumn
			//				
			this.uxLatestDataGridViewColumn.DisplayMember = "BatchId";	
			this.uxLatestDataGridViewColumn.ValueMember = "Id";	
			this.uxLatestDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxLatestDataGridViewColumn.DataSource = uxLatestBindingSource;				
				
			//
			// uxCreatedByDataGridViewColumn
			//				
			this.uxCreatedByDataGridViewColumn.DisplayMember = "Username";	
			this.uxCreatedByDataGridViewColumn.ValueMember = "Id";	
			this.uxCreatedByDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxCreatedByDataGridViewColumn.DataSource = uxCreatedByBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxDetailBatchTvtDataGridView);
			this.Name = "DetailBatchTvtDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxBatchIdBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxLatestBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxCreatedByBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDetailBatchTvtErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDetailBatchTvtDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDetailBatchTvtBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				DetailBatchTvtDataGridViewEventArgs args = new DetailBatchTvtDataGridViewEventArgs();
				args.DetailBatchTvt = _currentDetailBatchTvt;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class DetailBatchTvtDataGridViewEventArgs : System.EventArgs
		{
			private Entities.DetailBatchTvt	_DetailBatchTvt;
	
			/// <summary>
			/// the  Entities.DetailBatchTvt instance.
			/// </summary>
			public Entities.DetailBatchTvt DetailBatchTvt
			{
				get { return _DetailBatchTvt; }
				set { _DetailBatchTvt = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxDetailBatchTvtDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnDetailBatchTvtDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxDetailBatchTvtDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnDetailBatchTvtDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxDetailBatchTvtDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIdDataGridViewColumn":
						e.Value = DetailBatchTvtList[e.RowIndex].Id;
						break;
					case "uxBatchIdDataGridViewColumn":
						e.Value = DetailBatchTvtList[e.RowIndex].BatchId;
						break;
					case "uxMe1DataGridViewColumn":
						e.Value = DetailBatchTvtList[e.RowIndex].Me1;
						break;
					case "uxMe2DataGridViewColumn":
						e.Value = DetailBatchTvtList[e.RowIndex].Me2;
						break;
					case "uxIsStopDataGridViewColumn":
						e.Value = DetailBatchTvtList[e.RowIndex].IsStop;
						break;
					case "uxCreatedByDataGridViewColumn":
						e.Value = DetailBatchTvtList[e.RowIndex].CreatedBy;
						break;
					case "uxCreatedAtDataGridViewColumn":
						e.Value = DetailBatchTvtList[e.RowIndex].CreatedAt;
						break;
					case "uxInputTimeDataGridViewColumn":
						e.Value = DetailBatchTvtList[e.RowIndex].InputTime;
						break;
					case "uxLatestDataGridViewColumn":
						e.Value = DetailBatchTvtList[e.RowIndex].Latest;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxDetailBatchTvtDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnDetailBatchTvtDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxDetailBatchTvtDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIdDataGridViewColumn":
						DetailBatchTvtList[e.RowIndex].Id = (System.Int32)e.Value;
						break;
					case "uxBatchIdDataGridViewColumn":
						DetailBatchTvtList[e.RowIndex].BatchId = (System.Int32)e.Value;
						break;
					case "uxMe1DataGridViewColumn":
						DetailBatchTvtList[e.RowIndex].Me1 = (System.Int32)e.Value;
						break;
					case "uxMe2DataGridViewColumn":
						DetailBatchTvtList[e.RowIndex].Me2 = (System.Int32)e.Value;
						break;
					case "uxIsStopDataGridViewColumn":
						DetailBatchTvtList[e.RowIndex].IsStop = (System.Boolean)e.Value;
						break;
					case "uxCreatedByDataGridViewColumn":
						DetailBatchTvtList[e.RowIndex].CreatedBy = (System.Int32)e.Value;
						break;
					case "uxCreatedAtDataGridViewColumn":
						DetailBatchTvtList[e.RowIndex].CreatedAt = (System.DateTime)e.Value;
						break;
					case "uxInputTimeDataGridViewColumn":
						DetailBatchTvtList[e.RowIndex].InputTime = (System.DateTime)e.Value;
						break;
					case "uxLatestDataGridViewColumn":
						DetailBatchTvtList[e.RowIndex].Latest = (System.Int32?)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
